﻿using LIZTS.TODOS.Common.Models;
using Prism.Commands;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LIZTS.TODOS.ViewModels
{
    public class MemoViewModel : BindableBase
    {
        private ObservableCollection<MemoDto> memos;
        public DelegateCommand AddCommand { get; private set; }
        private bool isRightDrawerOpen;

        public bool IsRightDrawerOpen
        {
            get { return isRightDrawerOpen; }
            set
            {
                if (isRightDrawerOpen != value)
                {
                    isRightDrawerOpen = value;
                    RaisePropertyChanged();
                }
            }
        }


        public ObservableCollection<MemoDto> Memos
        {
            get { return memos; }
            set
            {
                memos = value;
                RaisePropertyChanged();
            }
        }

        public MemoViewModel()
        {
            Memos = new ObservableCollection<MemoDto>();
            AddCommand = new DelegateCommand(Add);
            MockData();
        }

        private void Add()
        {
            IsRightDrawerOpen = true;
        }

        private void MockData()
        {
            for (int i = 0; i < 20; i++)
            {
                Memos.Add(new MemoDto() { Title = "Memo: " + i, Content = "make it remember" });
            }
        }
    }
}
